<?php
if(isset($_POST['submit']))
{   $guid = $_POST['char'];
    $account = $_POST['username'];
	$query = "select name,banned from characters where guid='$guid'";
	$ban = mysql_query($query, $char) or die("Error #1: " . mysql_error());
	$ban2 = mysql_fetch_array($ban);
	if ($ban2[1] == "0")
	{
		$bann = "<span style='color:lime'>Your character $ban2[0] is not banned.</span>";
	} 
	else
	{
		$bann = "<span style='color:red'>Your character $ban2[0] is BANNED.</span>";
	}
	echo "<center><br><span style='font-size: 18px; font-family:Century Gothic, Arial, Helvetica; color:#ffffff' >Character Ban Checker</span><br><br>$bann<br><br><a href='tool.php?bancheck'>Go Back</a><br><br></center>";
}
else
{
    echo "<form name='unstucker' method='post' action='tool.php?bancheck'>";
    echo "<center><br><span style='font-size: 18px; font-family:Century Gothic, Arial, Helvetica; color:#ffffff' >Character Ban Checker</span><br><br>";
	$user = $_SESSION['user'];
    $getuser = "SELECT * from b_users a, b_templates b where b.templateid=a.templateclass and a.username='$user'";
    $getuser2 = mysql_query($getuser, $forum) or die("Error #2: " . mysql_error());
    $getuser3 = mysql_fetch_array($getuser2);
	
	$SQLwow = "SELECT * from accounts where login='$getuser3[username]'";
	$SQLwow2 = mysql_query($SQLwow, $logon) or die("Error #3: " . mysql_error());
	$SQLwow3 = mysql_fetch_array($SQLwow2);
	
	$SQLawow = "SELECT * from characters where acct='$SQLwow3[acct]'";
	$char = mysql_query($SQLawow, $char) or die("Error #4: " . mysql_error());
	
	print "<select name='char' style=' background-color:#000033; color:#FFFFFF; border: 1px solid #333333'>";
	while ($char2 = mysql_fetch_array($char))
	{
		if ($char2['guid'] == $getuser3['charid'])
		{
			print "<option selected='selected' value='$char2[guid]'>-> $char2[name]</option><br>";
		}
		else
		{
			print "<option value='$char2[guid]'>$char2[name]</option><br>";
		}
	}
	print "</select><br><br>";
	echo "<input name='username' type='hidden' value='$user' />";
	echo "<br><input type=submit name=submit value='Check if character is banned or not' style='background-color:#000033; color:#FFFFFF; border: 1px solid #333333'><br>";
	echo "</form><br><br>";
	echo "</center>";
}
?>